home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PRUS101.ZIP / FTMODE.PAS < prev    next >
Pascal/Delphi Source File  |  1994-07-20  |  19KB  |  637 lines

  1. Unit FTMode; { FIDO unit for handling of 'weird' text modes }
  2.  (***************************************************************************
  3.  
  4.            RELEASE 1.03 - as contained in the file PRUS100.LZH
  5.                  by Max Maischein, 2:244/1106.17, GERMANY
  6.  
  7.                --------------------------------------------
  8.                 organized for Fido's PASCAL related echoes
  9.                --------------------------------------------
  10.  
  11.      05/18/1994 to 05/21/1994 by Orazio Czerwenka, 2:2450/540.55, GERMANY
  12.      05/22/1994 to --/--/---- by Max Maischein,    2:244/1106.17, GERMANY
  13.  
  14.            As far as third party copyrights are not violated this
  15.            source code is hereby placed to the public domain. Use
  16.            it whatever way you want, but use AT YOUR OWN RISK.
  17.  
  18.            In case you should modify the source rather send your
  19.            modifications to the unit's current organizer (see above for
  20.            NM address) than to spread it on your own. This will help to
  21.            keep the unit updated and grant a certain standard to all
  22.            other users as well.
  23.  
  24.            The unit is currently still under work. So it might greatly
  25.            benefit of your participation.
  26.  
  27.            Those who contributed to the following piece of source,
  28.            listed in alphabethical order:
  29.         ================================================================
  30.            Martin Austermeier (as credited in ZEILEN.PAS), Orazio
  31.            Czerwenka, Richard Kitson, Olaf Kummer (EMODE.PAS, c't
  32.            09/91), Wilbert van Leijen (VGA90.ASM), Max Maischein (Unit
  33.            EMODE.PAS), Bernhard Steffen (80x33 Mode), Wolfgang Wichern
  34.            (ZEILEN.PAS) ...
  35.         ================================================================
  36.            YOUR NAME WILL APPEAR HERE IF YOU CONTRIBUTE USEFUL SOURCE.
  37.  
  38.            This unit basically is based upon Max Maischein's PD-Unit
  39.            EMODE.PAS.
  40.  
  41.            Credits in your own programs are owed to Max Maischein as
  42.            demanded in his Unit EMODE.PAS and to the German 'techie
  43.            journal' c't.
  44.  
  45.  ***************************************************************************)
  46.  
  47. {$I FDEFINE.DEF}
  48.  
  49. Interface
  50. Uses
  51.   DOS
  52. {$IFDEF DPMI}
  53.   ,WinAPI
  54.   ,fDPMI
  55. {$ENDIF}
  56. {$IFDEF CRT}  ,CRT  {$ENDIF}
  57. {$IFDEF FCRT} ,FCRT {$ENDIF}
  58. {$IFDEF CRT2} ,CRT2 {$ENDIF}
  59.   ;
  60.  
  61. Const
  62.   ftmOK = 0;
  63.   ftmUnsupportedLines = 1;
  64.   ftmUnsupportedColumns = 2;
  65.  
  66.   FTMError : Integer = ftmOK;
  67.   { this integer will hold the status of the last mode set }
  68.  
  69.   KnownColumns = [40,80,90,94];
  70.   KnownLines = [12,14,21,25,28,30,33,34,40,43,50,60];
  71.  
  72. { ************************************************************************** }
  73.  
  74.   { these are constants to switch to the enhanced text modes provided via
  75.     the unit FTMODE by simply using an enhanced TEXTMODE routine.
  76.     NOTICE that most of these enhanced modes will run only on VGA systems.
  77.     Some of'em won't display correctly in 90 column mode when used with
  78.     older displays. Some others might well be run also on EGA systems, but
  79.     for we have not tested this so far, there is no validity checking
  80.     implemented for different card settings. You have to find out yourself.
  81.     Please report your results to the current 'unit's organizer' of the unit
  82.     FTMODE. }
  83.  
  84.   Co40x12   = 12 SHL 8 + 40;    Co80x12   = 12 SHL 8 + 80;
  85.   Co40x14   = 14 SHL 8 + 40;    Co80x14   = 14 SHL 8 + 80;
  86.   Co40x21   = 21 SHL 8 + 40;    Co80x21   = 21 SHL 8 + 80;
  87.   Co40x25   = 25 SHL 8 + 40;    Co80x25   = 25 SHL 8 + 80;
  88.   Co40x28   = 28 SHL 8 + 40;    Co80x28   = 28 SHL 8 + 80;
  89.   Co40x30   = 30 SHL 8 + 40;    Co80x30   = 30 SHL 8 + 80;
  90.   Co40x33   = 33 SHL 8 + 40;    Co80x33   = 33 SHL 8 + 80;
  91.   Co40x34   = 34 SHL 8 + 40;    Co80x34   = 34 SHL 8 + 80;
  92.   Co40x40   = 40 SHL 8 + 40;    Co80x40   = 40 SHL 8 + 80;
  93.   Co40x43   = 43 SHL 8 + 40;    Co80x43   = 43 SHL 8 + 80;
  94.   Co40x50   = 50 SHL 8 + 40;    Co80x50   = 50 SHL 8 + 80;
  95.   Co40x60   = 60 SHL 8 + 40;    Co80x60   = 60 SHL 8 + 80;
  96.  
  97.   Co90x12   = 12 SHL 8 + 90;    Co94x12   = 12 SHL 8 + 94;
  98.   Co90x14   = 14 SHL 8 + 90;    Co94x14   = 14 SHL 8 + 94;
  99.   Co90x21   = 21 SHL 8 + 90;    Co94x21   = 21 SHL 8 + 94;
  100.   Co90x25   = 25 SHL 8 + 90;    Co94x25   = 25 SHL 8 + 94;
  101.   Co90x28   = 28 SHL 8 + 90;    Co94x28   = 28 SHL 8 + 94;
  102.   Co90x30   = 30 SHL 8 + 90;    Co94x30   = 30 SHL 8 + 94;
  103.   Co90x33   = 33 SHL 8 + 90;    Co94x33   = 33 SHL 8 + 94;
  104.   Co90x34   = 34 SHL 8 + 90;    Co94x34   = 34 SHL 8 + 94;
  105.   Co90x40   = 40 SHL 8 + 90;    Co94x40   = 40 SHL 8 + 94;
  106.   Co90x43   = 43 SHL 8 + 90;    Co94x43   = 43 SHL 8 + 94;
  107.   Co90x50   = 50 SHL 8 + 90;    Co94x50   = 50 SHL 8 + 94;
  108.   Co90x60   = 60 SHL 8 + 90;    Co94x60   = 60 SHL 8 + 94;
  109.  
  110.   { the following constants are intended to provide CRT TEXTMODE
  111.     compatibility }
  112.  
  113.   BW40    = 0; Co40    = 1;
  114.   BW80    = 2; Co80    = 3;
  115.   Mono    = 7; Font8x8 = 256;
  116.   C40     = Co40;      C80     = Co80;
  117.  
  118. { ************************************************************************** }
  119.  
  120. VAR DisplayMode    : Byte Absolute $40:$49;
  121.     DisplayCols    : Word absolute $40:$4A;
  122.     EGADisplayRows : Byte Absolute $40:$84;
  123.   {$IFnDEF FCRT}
  124.     RegenBufLen    : Word Absolute $40:$4C;
  125.   {$ENDIF}
  126.     CharScanLines  : Byte absolute $40:$85;
  127.  
  128. {$IFDEF FCRT}
  129. procedure TextMode(Mode: WORD);
  130. {$ENDIF}
  131.  
  132. Procedure SetVGAMode( Cols, Lines : Byte );
  133. (* Sets a video mode with the specified number of columns and lines *)
  134. (* If one of them is zero, the current value will remain unchanged *)
  135.  
  136. Procedure VGAFontHeight( Size : Byte );
  137.  
  138. Procedure Load8x8;
  139. Inline(
  140. $B8/$02/$11             { MOV   AX,1102 }
  141. /$30/$DB                { XOR   BL,BL   }
  142. /$CD/$10                { INT   10      }
  143. );
  144.  
  145. Procedure Load14x8;
  146. Inline(
  147. $B8/$01/$11             { MOV   AX,1101 }
  148. /$30/$DB                { XOR   BL,BL   }
  149. /$CD/$10                { INT   10      }
  150. );
  151.  
  152. Procedure Load16x8;
  153. Inline(
  154. $B8/$04/$11             { MOV   AX,1104 }
  155. /$30/$DB                { XOR   BL,BL   }
  156. /$CD/$10                { INT   10      }
  157. );
  158.  
  159. Procedure Set200ScanLines;
  160. Inline(
  161. $B8/$00/$12             { MOV   AX,1200 }
  162. /$B3/$30                { MOV   BL,30   }
  163. /$CD/$10                { INT   10      }
  164. );
  165.  
  166. Procedure Set350ScanLines;
  167. Inline(
  168. $B8/$01/$12             { MOV   AX,1201 }
  169. /$B3/$30                { MOV   BL,30   }
  170. /$CD/$10                { INT   10      }
  171. );
  172.  
  173. Procedure Set400ScanLines;
  174. Inline(
  175. $B8/$02/$12             { MOV   AX,1202 }
  176. /$B3/$30                { MOV   BL,30   }
  177. /$CD/$10                { INT   10      }
  178. );
  179.  
  180. Procedure Set480Scanlines;
  181.  
  182. Implementation
  183.  
  184. {$IFDEF CRT}
  185. {$IFnDEF FCRT}
  186. Procedure SetVideoMode( VideoMode : Word ); forward;
  187. {$ENDIF}
  188. {$ENDIF}
  189.  
  190. Procedure VGAOn;
  191. Assembler;
  192. Asm
  193.         mov     dx, 03D4h
  194.         mov     al, 17
  195.         out     dx, al
  196.         inc     dx
  197.         in      al, dx
  198.         or      al, 80h
  199.         out     dx, al
  200.         dec     dx                      { dx = 03D4h }
  201.  
  202.         mov     al, 23                  {CRTC-Reset freigeben}
  203.         out     dx, al
  204.         inc     dx
  205.         in      al, dx
  206.         or      al, 80h
  207.         out     dx, al
  208.  
  209.         sub     dl, 11h                 { dx = 03C4h }
  210.         mov     ax, 0300h               {Sequenzer einschalten}
  211.         out     dx, ax
  212.  
  213.         sti
  214. End;
  215.  
  216. Procedure VGAOff;
  217. Assembler;
  218. Asm
  219.         cli
  220.         mov     dx, 03C4h
  221.         mov     ax, 0100h               {Sequenzer ausschalten}
  222.         out     dx, ax
  223.  
  224.         add     dl, 10h                 { dx = 03D4h }
  225.         mov     al, 23                  {CRTC-Reset setzen}
  226.         out     dx, al
  227.         inc     dx
  228.         in      al, dx
  229.         and     al, 07Fh
  230.         out     dx, al
  231.         dec     dx
  232.  
  233.         mov     al, 17                  {CRTC-Register 0-7 freigeben}
  234.         out     dx, al
  235.         inc     dx
  236.         in      al, dx
  237.         and     al, 07Fh
  238.         out     dx, al
  239. End;
  240.  
  241. Const CRTCTableSize = 9;
  242. {$IFnDEF UseBIOS}
  243. Const VGA80ColData : Array[ 0..Pred( CRTCTableSize )] of Word = (
  244. $5F00,                         { horizontal total = 95 columns }
  245. $4F01,                         { displayed total = 80 - 1 columns }
  246. $5002,                         { start horiz blanking = column 80 }
  247. $8203,                         { end blanking set }
  248. $5504,                         { start horizontal retrace set }
  249. $8105,                         { end retrace set }
  250. $2813,                         { Logical Line Width (80/2)}
  251. { -- }
  252. $0001,                         { 8-PEL Chars }
  253. {--}
  254. $0800                          { PEL pan }
  255. );
  256. {$ENDIF}
  257.  
  258. Const VGA90ColData : Array[ 0..Pred( CRTCTableSize )] of Word = (
  259. $6B00,                         { horizontal total-5 }
  260. $5901,                         { displayed total = 90 - 1 columns }
  261. $5A02,                         { start horiz blanking = column 90 }
  262. $8E03,                         { end blanking set }
  263. $6004,                         { start retrace set }
  264. $8D05,                         { end retrace set }
  265. $2D13,                         { Logical Line Width (90/2)}
  266. { -- }
  267. $0101,                          { 8-PEL Chars }
  268. { -- }
  269. $0800                           { PEL pan }
  270. );
  271.  
  272. Const VGA94ColData : Array[ 0..Pred( CRTCTableSize )] of Word = (
  273. $6C00,                         { Horizontal Total-5}
  274. $5D01,                         { Hor. Display Enable End - 1}
  275. $5E02,                         { Start Horizontal Blanking}
  276. $8F03,                         { End Horizontal Blanking}
  277. $6204,                         { Start Horizontal Retrace}
  278. $8E05,                         { End Horizont2al Retrace}
  279. $2F13,                         { Logical Line Width (94/2)}
  280. { -- }
  281. $0101,                         { 8-PEL Chars }
  282. { -- }
  283. $0000                          { PEL pan }
  284. );
  285.  
  286. Const VGA480Entries = 8;
  287.       VGA480SLinesTable : Array[ 0..Pred(VGA480Entries )] of Word = (
  288. $0B06,                         {Vertical Total}
  289. $3E07,                         {CRT Overflow}
  290. $4F09,                         {Maximum Scan Line}
  291. $EA10,                         {Start Vertical Retrace}
  292. $8C11,                         {End Vertical Retrace}
  293. $DF12,                         {Vert. Display Enable End}
  294. $E715,                         {Start Vertical Blanking}
  295. $0416
  296. );
  297.  
  298. Procedure UpdateCRTCData;
  299. Assembler;
  300. (* ds:si -> New sequencer register table *)
  301. Asm
  302.                         cld
  303.                         mov     dx, 03D4h
  304.                         mov     cx, CRTCTableSize-2
  305.                         rep     outsw
  306.  
  307.                         mov     dx, 03C4h               { set 8/9 PEL wide
  308. chars }
  309.                         outsw
  310.  
  311.                         lodsw                           { update PEL panning
  312. register }
  313.  
  314.                         mov     dx, 03DAh               { dummy read to reset
  315. flip-flop }
  316.                         in      al, dx
  317.                         mov     dx, 03C0h               { Horizontal PEL
  318. Panning }
  319.                         mov     al, $13                 { PEL Panning }
  320.                         out     dx, al
  321.                         mov     al, ah
  322.                         out     dx, al
  323.                         mov     al, 20h                 { ???? }
  324.                         out     dx, al
  325.                         out     dx, al
  326. End;
  327.  
  328. Procedure VGA94Columns;
  329. Assembler;
  330. Asm
  331.         mov     dx, 03CCh
  332.         in      al, dx
  333.         and     al, 0F3h
  334.         or      al, 4
  335.         sub     dx, 0Ah                 { dx = 03C2h }
  336.         out     dx, al                  { 720 PEL wählen}
  337.  
  338.         mov     si, offset VGA94ColData
  339.         call    UpdateCRTCData          { dx = 03D4h }
  340. End;
  341.  
  342. Procedure VGA90Columns;
  343. Assembler;
  344. Asm
  345.            mov     si, offset VGA90ColData
  346.            call    UpdateCRTCData
  347. End;
  348.  
  349. {$IFnDEF UseBIOS}
  350. Procedure VGA80Columns; Assembler;
  351. Asm
  352.            mov     si, offset VGA80ColData
  353.            call    UpdateCRTCData
  354. End;
  355. {$ENDIF}
  356.  
  357. Procedure VGA33Zeilen;
  358. Type
  359.   TVGA8x14 = Array[ Char, 0..13] of Byte;
  360.   TVGA8x12 = Array[ Char, 0..11] of Byte;
  361.  
  362.   PVGA8x12 = ^TVGA8x12;
  363.   PVGA8x14 = ^TVGA8x14;
  364.  
  365. Var Font8x12 : TVGA8x12;         { Memory allocated on stack !!! }
  366.     Font8x14 : TVGA8x14;
  367.  
  368.   Procedure GetFont8x14;
  369.   Var
  370.   {$IFDEF DPMI}
  371.     Regs : TRealModeRegs;
  372.   {$ELSE}
  373.     Regs : Registers;
  374.   {$ENDIF}
  375.   Begin
  376.     {$IFDEF DPMI}
  377.       FillChar( Regs, SizeOf( Regs ), 0 );
  378.     {$ENDIF}
  379.     Regs.AX := $1130;
  380.     Regs.BH := 2;
  381.     {$IFDEF DPMI}
  382.       RealModeInt( $10, Regs );
  383.       Regs.ES := NewSelector( Regs.ES*LongInt( 16 ), $FFFF );
  384.     {$ELSE}
  385.       Intr ($10,Regs);
  386.     {$ENDIF}
  387.  
  388.     Font8x14 := PVGA8x14( Ptr( Regs.ES,Regs.BP ))^;
  389.  
  390.     {$IFDEF DPMI}
  391.       FreeSelector( Regs.ES );
  392.     {$ENDIF}
  393.   End;
  394.  
  395.   Procedure SetUserFont (Lines : BYTE; Data : TVGA8x12);
  396.   Var
  397.   {$IFDEF DPMI}
  398.     Regs : TRealModeRegs;
  399.     LowMemoryData : Pointer;
  400.     LowMemorySeg : Word;
  401.   {$ELSE}
  402.     Regs : Registers;
  403.   {$ENDIF}
  404.   Begin
  405.     {$IFDEF DPMI}
  406.       FillChar( Regs, SizeOf( Regs ), 0 );
  407.     {$ENDIF}
  408.     Regs.ax := $1110;
  409.     Regs.bh := Lines;
  410.     Regs.bl := 0;
  411.     Regs.cx := 256;
  412.     Regs.dx := 0;
  413.     {$IFDEF DPMI}
  414.       Regs.ES := AllocateLowMem( SizeOf( Data ), LowMemoryData );
  415.       Regs.BP := 0;
  416.       Move( Data, LowMemoryData^, SizeOf( Data ));
  417.       FillChar( LowMemoryData^, SizeOf( LowMemoryData^ ), 0 );
  418.       RealModeInt( $10, Regs );
  419.       FreeLowMem( LowMemoryData );
  420.     {$ELSE}
  421.       Regs.es := seg( Data );
  422.       Regs.bp := ofs( Data );
  423.       Intr($10,regs);
  424.     {$ENDIF}
  425.   End;
  426.  
  427. Var Ch : Char ;
  428.  
  429. Begin
  430.   { 8x14-Font auslesen }
  431.   GetFont8x14;
  432.  
  433.   { Rasterzeilen 2 bis 13 kopieren }
  434.   For Ch := #0 to #255 do
  435.     Move(Font8x14[ Ch, 1 ],Font8x12[ Ch, 0 ],12 );
  436.  
  437.   { neuen 8x12-Font setzen }
  438.   SetUserFont(12, Font8x12 );
  439. End;
  440.  
  441. Procedure Set480Scanlines;
  442. Assembler;
  443. Asm
  444.         mov     dx, 03CCh
  445.         in      al, dx
  446.         or      al, 192
  447.         sub     dx, 0Ah                 { dx = 03C2h }
  448.         out     dx, al                  { Sync-Polarität setzen}
  449.  
  450.         cld
  451.         add     dx, 012h                { dx = 03D4h }
  452.         mov     si, offset VGA480SLinesTable
  453.         mov     cx, VGA480Entries
  454.         rep     outsw
  455. End;
  456.  
  457. Procedure VGAFontHeight( Size : Byte );
  458. { Updates the BIOS data area }
  459. Begin
  460.   Mem[0:$485] := Size;                 {BIOS informieren}
  461.   Port[$3D4] := 9;                     {Maximum Scan Line}
  462.   Port[$3D5] := (Port[$3D5] and $E0) + Size - 1;
  463.  
  464.   Port[$3D4] := 10;                    {Cursor Start}
  465.   If Size <= 12 then Port[$3D5] := Size - 2 else Port[$3D5] := Size - 3;
  466.   Port[$3D4] := 11;                    {Cursor End}
  467.   If Size <= 12 then Port[$3D5] := Size - 1 else Port[$3D5] := Size - 2;
  468. End;
  469.  
  470. Procedure SetVGAMode( Cols, Lines : Byte );
  471. Var SLines : Byte;
  472.     Force80Columns : Boolean;
  473.     ChangeColumns, ChangeLines : Boolean;
  474. Begin
  475.   ChangeColumns := Cols <> 0;
  476.   ChangeLines := Lines <> 0;
  477.  
  478.   If ChangeColumns and not ( Cols in KnownColumns )
  479.     then ftmError := ftmUnsupportedColumns;
  480.  
  481.   If ChangeLines and not ( Lines in KnownLines )
  482.     then ftmError := ftmUnsupportedLines;
  483.  
  484.   If ftmError <> ftmOK
  485.     then Exit;
  486.  
  487.   { Check for invalid line specification and set scan lines }
  488.   { ------------------------------------------------------- }
  489.   Case Lines of
  490.                             12, 14 : Set200ScanLines;
  491.                             21, 43 : Set350ScanLines;
  492.     25, 28, 30, 33, 34, 40, 50, 60 : Set400ScanLines;
  493.   End; { of Case Lines of }
  494.  
  495.   { set VideoMode }
  496.   { ------------- }
  497.   Case Cols of
  498.             40 : SetVideoMode( 1 );
  499.     80, 90, 94 : SetVideoMode( 3 );
  500.   End;
  501.   {$IFnDEF UseBIOS}
  502.   Force80Columns := DisplayCols <> 80;
  503.   {$ENDIF}
  504.  
  505.  { Load the equivalent BIOS font }
  506.  { ----------------------------- }
  507.   Case Lines of
  508.     12, 21, 25, 30 : Begin Load16x8; SLines := 16; End;
  509.         14, 28, 34 : Begin Load14x8; SLines := 14; End;
  510.             33, 40 : Begin VGA33Zeilen; SLines := 12; End;
  511.         43, 50, 60 : Begin Load8x8;  SLines := 8;  End;
  512.   End; { of Case Lines }
  513.  
  514.   If ( Cols in [90,94] ) or ( Lines in [30,34,40,60] )
  515.   {$IFnDEF UseBIOS} or Force80Columns {$ENDIF}
  516.     then
  517.       Begin
  518.         VGAOff;
  519.  
  520. {$IFnDEF UseBIOS}
  521.         If Cols = 80
  522.           then VGA80Columns
  523.           else
  524. {$ENDIF}
  525.         If Cols = 90
  526.           then VGA90Columns
  527.           else
  528.         If Cols = 94
  529.           then VGA94Columns;
  530.  
  531.         If Lines in [30,34,40,60]
  532.           then Set480ScanLines;
  533.  
  534.         VGAOn;
  535.       End;
  536.  
  537.  { Tell the VGA, the BIOS and FCRT what's going on }
  538.  { If FCRT is linked call ReInitFCRT }
  539.  { If CRT is linked, update WindMax }
  540.  
  541.   VGAFontHeight( SLines );
  542.   If ChangeColumns
  543.     then DisplayCols := Cols;
  544.   If ChangeLines
  545.     then EGADisplayRows:= Pred( Lines );
  546. {$IFnDEF FCRT}
  547.   RegenBufLen   := ( DisplayCols * ( EGADisplayRows +1 )) * 2;
  548. {$ELSE}
  549.   VideoPageSize := ( DisplayCols * ( EGADisplayRows +1 )) * 2;
  550. {$ENDIF}
  551.  
  552.  { if necessary, update the local control variables of those units : }
  553. {$IFDEF FCRT}
  554.   {
  555.   MaxX := DisplayCols;
  556.   MaxY := EGADisplayRows;
  557.   If VGACard then Inc(MaxY);
  558.   }
  559.   ReInitFCRT;
  560. {$ENDIF}
  561. {$IFDEF CRT} 
  562.   WindMax := DisplayCols + EGADisplayRows *256;
  563. {$ENDIF} 
  564. End;
  565.  
  566. { ************************************************************************** }
  567.  
  568. {$IFDEF FCRT}
  569. procedure TextMode(Mode:WORD);
  570. { Original author: Orazio Czerwenka }
  571. var
  572.   x,y : Byte;
  573. procedure UpdateBiosMem;
  574. var
  575.   LoMode : word absolute $40:$4A;
  576.   HiMode : word absolute $40:$84;
  577.   MoSize : word absolute $40:$4C;
  578. begin
  579.    LoMode := 80;
  580.    if EGAAvail then begin
  581.      if VGAAvail then begin
  582.        HiMode := 49;
  583.        MoSize := 80*50*2;
  584.      end
  585.      else begin
  586.        HiMode := 42;
  587.        MoSize := 80*43*2;
  588.      end;
  589.    end
  590.    else begin
  591.      HiMode := 24;
  592.      MoSize := 80*25*2;
  593.    end;
  594. end;
  595. begin
  596.   CASE Mode of
  597.         0..7: SetVideoMode(Mode);
  598.     256..263: Begin
  599.                 if EGAAvail then begin
  600.                   if VGAAvail
  601.                     then Set400ScanLines
  602.                     else Set350ScanLines;
  603.                   SetVideoMode(Mode-font8x8);
  604.                   Load8x8;
  605.                   VGAFontHeight(8);
  606.                 end
  607.                 else SetVideoMode(Mode);
  608.                 UpdateBiosMem;
  609.                 ReInitFCRT;
  610.               END; { begin }
  611.          else begin
  612.                 x:= Lo(Mode); y:= Hi(Mode);
  613.                 if VGAAvail then SetVGAMode(x,y) else begin
  614.  
  615.                   { here will be implemented support for other
  616.                     graphics adapters in future releases }
  617.  
  618.                 end;
  619.               end; { else }
  620.   end; { Case }
  621. end;
  622. {$ENDIF}
  623.  
  624. { ************************************************************************** }
  625.  
  626. {$IFDEF CRT}
  627. {$IFnDEF FCRT}
  628. Procedure SetVideoMode;
  629. Begin
  630.   VideoMode := VideoMode and $FF;
  631.   TextMode( VideoMode );
  632. End;
  633. {$ENDIF}
  634. {$ENDIF}
  635.  
  636. End.
  637.